package de.mssp.sensorkit;

import de.mssp.sensorkit.accelerometer.AccelerometerActivity;
import de.mssp.sensorkit.bluetooth.BluetoothActivity;
import de.mssp.sensorkit.compass.CompassActivity;
import de.mssp.sensorkit.gps.GPSActivity;
import de.mssp.sensorkit.wlan.WLANActivity;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class Sensorkit extends TabActivity 
{
	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		this.setRequestedOrientation(1); // 1 = Portrait

		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Reusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, AccelerometerActivity.class);

		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("accelerometer").setIndicator("Accelerometer").setContent(intent);
		tabHost.addTab(spec);

		// Do the same for the other tabs
		intent = new Intent().setClass(this, WLANActivity.class);
		spec = tabHost.newTabSpec("wlan").setIndicator("WLAN").setContent(intent);
		tabHost.addTab(spec);

		intent = new Intent().setClass(this, GPSActivity.class);
		spec = tabHost.newTabSpec("gps").setIndicator("GPS").setContent(intent);
		tabHost.addTab(spec);

		intent = new Intent().setClass(this, BluetoothActivity.class);
		spec = tabHost.newTabSpec("bluetooth").setIndicator("Bluetooth").setContent(intent);
		tabHost.addTab(spec);

		intent = new Intent().setClass(this, CompassActivity.class);
		spec = tabHost.newTabSpec("compass").setIndicator("Compass").setContent(intent);
		tabHost.addTab(spec);

		tabHost.setCurrentTab(0);
	}
}